import time

import requests
import hashlib



headers = {
    "Host": "match.yuanrenxue.com",
    "Connection": "keep-alive",
    "Pragma": "no-cache",
    "Cache-Control": "no-cache",
    "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"102\", \"Google Chrome\";v=\"102\"",
    "Accept": "application/json, text/javascript, */*; q=0.01",
    "X-Requested-With": "XMLHttpRequest",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "Sec-Fetch-Site": "same-origin",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Dest": "empty",
    "Referer": "https://match.yuanrenxue.com/match/20",
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "user-agent": "yuanrenxue.project;"
}
cookies = {
    "sessionid": "2t95ns5rr1grsim3js227tfwclhfv8ip",
}
url = "https://match.yuanrenxue.com/api/match/20"
num = 0
for i in range(1, 6):
    m = hashlib.md5()
    t = str(int(time.time()) * 1000)
    strs = f'{i}|{t}D#uqGdcw41pWeNXm'.encode()
    m.update(strs)
    params = {
        "page": str(i),
        "sign": m.hexdigest(),
        "t": t
    }
    response = requests.get(url, headers=headers, cookies=cookies, params=params,verify=False).json()
    print(response)
    for j in response["data"]:
        num += j["value"]
print(num)
